package org.ds.util;

import org.ds.biz.user.LoginUser;

/**
 * A simple utility class to hold on to application specific information.
 * As of now contains a method to get to the "user object" that is trying
 * to login in to the application. At any point, there is only one instance
 * of the Application (singelton pattern).
 * 
 * Not thread safe (not yet).
 * 
 * @author Kartick Suriamoorthy
 */
public class ApplicationContext
{
	private static ApplicationContext appContext = null;

	// static method - to get an instance of the ApplicationContext
	public static ApplicationContext getInstance()
	{
		if (appContext == null)
		{
			appContext = new ApplicationContext();
		}

		return appContext;
	}
	
	// public methods
	public LoginUser getLoginUser()
	{
		LoginUser user = new LoginUser();

		user.setUsername("yoda");
		user.setPassword("Dick.Clark");

		return user;
	}

	// private methods
	private ApplicationContext()
	{
	}
}
